package com.sky.controller.user;

import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Author: 笨蛋超人不会飞
 * Date:  21:00
 */
@RestController("userCategoryController")
@RequestMapping("/user/category")
@Slf4j
@Api("菜品分类接口")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;
    /*
     * 根据类型查询（type）分类
     * */
    @GetMapping("/list")
    public Result getlist(Integer type){
        //先进行日志输出
        log.info("根据类型查询分类 {}",type);
        List<Category> list=categoryService.getlist(type);
        return Result.success(list);
    }

}
